<template>
  <div class="common">
    <div class="logo"></div>
    <!-- 分类选项 -->
    <ul class="header">
      <li><router-link to="/">首页</router-link></li>
      <li v-for="item in cate" :key="item.id">
        <router-link :to="'/cate?id=' + item.id">{{ item.name }}</router-link>
        <!-- 弹框 -->
        <div class="layer">
          <ul>
            <li v-for="it in item.children" :key="it.id">
              <router-link :to="'/cate/sub?id=' + it.id">
                <img :src="it.picture" alt="" />
                <p>{{ it.name }}</p>
              </router-link>
            </li>
          </ul>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "Com",
  data() {
    return {};
  },

  components: {},

  computed: {
    cate() {
      return this.$store.state.category.cate;
    },
  },
  mounted() {},

  methods: {},
  watch: {},
  mixins: [],
};
</script>
<style scoped lang="scss">
@import "@/assets/css/color.scss";
.common {
  display: flex;
  .logo {
    width: 200px;
    height: 80px;
    cursor: pointer;
    background: url(@/assets/img/logo.0940ebb5.png) no-repeat center / contain;
    background-size: 85%;
  }
  .header {
    width: 820px;
    display: flex;
    align-items: center;
    padding-left: 40px;
    position: relative;
    z-index: 998;
    > li {
      margin-right: 40px;
      width: 38px;
      text-align: center;
      > a {
        font-size: 16px;
        line-height: 32px;
        height: 32px;
        display: inline-block;
      }
      &:hover {
        > a {
          color: $xtxColor;
          border-bottom: 1px solid $xtxColor;
        }
        > .layer {
          height: 132px;
          opacity: 1;
        }
      }
    }
  }
  .layer {
    width: 1240px;
    background-color: #fff;
    position: absolute;
    left: -200px;
    top: 80px;
    height: 0;
    overflow: hidden;
    opacity: 0;
    box-shadow: 0 0 5px #ccc;
    transition: all 0.2s 0.1s;
    ul {
      display: flex;
      flex-wrap: wrap;
      padding: 0 70px;
      align-items: center;
      height: 132px;
      li {
        width: 110px;
        text-align: center;
        img {
          width: 60px;
          height: 60px;
        }
        p {
          padding-top: 10px;
        }
        &:hover {
          p {
            color: $xtxColor;
          }
        }
      }
    }
  }
}
</style>
